package com.yylending.las.repay.repayrecord;

import com.yyfax.infrastructure.eventbus.EventAgent;
import com.yyfax.infrastructure.mvp.Model;
import com.yyfax.infrastructure.network.NetworkHelper;
import com.yyfax.infrastructure.network.entity.BaseResultEntity;
import com.yylending.las.YJKD;

import java.util.ArrayList;
import java.util.List;

import retrofit2.http.Body;
import retrofit2.http.Header;
import retrofit2.http.POST;
import rx.Observable;

/**
 * Created by ying_he on 2017/6/8.<br>
 * Copyright  2017 www.yylending.com. All Rights Reserved.<br><br>
 */

public class RepayPlanOrHistoryModel extends Model {
    @Override
    public Observable getObservable(Object params, int functionalCode) {
        Service service = (Service) NetworkHelper.createService(Service.class);
        String token = YJKD.getInstance().getPreferenceManager().getLoginToken();
        return service.getRepayStatus(token, (RequestParams) params);
    }

    @Override
    public void onNext(Object entity) {
        RepayStatusResult statusResult = cast(entity);
        EventAgent.post(statusResult);
    }

    public interface Service {
        @POST("")
        Observable<RepayStatusResult> getRepayStatus(@Header("token") String token, @Body RequestParams requestParams);
    }

    static class RequestParams{


    }

    static class RepayStatusResult extends BaseResultEntity<RepayData> {

    }

    public static class RepayData {
        List<RepayItem> repayItems = new ArrayList<>();


        public static class RepayItem{

        }
    }
}
